package cmd

import (
	"fmt"
	"github.com/spf13/cobra"
	"runtime"
)

var showVersiondetail bool

var (
	Version   string
	GitHash   string
	BuildTime string
)

var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: "show version",
	Run: func(cmd *cobra.Command, args []string) {
		if showVersiondetail {
			fmt.Printf("Version: %s\n", Version)
			fmt.Printf("GitHash: %s\n", GitHash)
			fmt.Printf("Go Version: %s\n", runtime.Version())
			fmt.Printf("Go OS/Arch: %s/%s\n", runtime.GOOS, runtime.GOARCH)
			fmt.Printf("BuildTime: %s\n", BuildTime)
		} else {
			fmt.Printf("Version: %s\n", Version)
		}

	},
}
